package com.wenlong.agricultural.config;

import com.wenlong.agricultural.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author 苏文龙
 * @version 1.0
 */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor())
                .addPathPatterns("/**")
                .excludePathPatterns("/",
                        "/agricultural/", "/agricultural/index",
                        "/agricultural/login", "/agricultural/register",
                        "/agricultural/loginInfo", "/agricultural/success", "/agricultural/getVailUsername",
                        "/css/**", "/image/**", "/js/**");
    }
}
